package com.demo.springmvc.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * 
 * @Desc
 *
 * @Author dreajay
 * @DateTime 2016年9月1日 下午3:29:39
 *
 */
@Controller
@RequestMapping("/pathVariabl")
public class PathVariablController {

	/**
	 * 通过@PathVariabl获取请求路径中的参数
	 * 
	 * @param id
	 * @param name
	 * @param model
	 * @return
	 */
	@RequestMapping(value = "user/{id}/{name}", method = RequestMethod.GET)
	public String getUser(@PathVariable String id, @PathVariable String name, ModelMap model) {
		System.out.println(id);
		System.out.println(name);
		model.addAttribute("message", "111111");
		return "users";
	}

}